<%@tag import="by.epam.communalservices.utils.Login"%>

<%@tag import="java.sql.Connection"%>
<%@ attribute name="task" required="true" type="by.epam.communalservices.entity.JkhTask"%>
<%@ attribute name="dif"%>


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/connect" prefix="connect"%>
<%@ taglib tagdir="/WEB-INF/tags/table" prefix="table"%>
<%@ taglib tagdir="/WEB-INF/tags/object" prefix="object"%>
<%@ taglib tagdir="/WEB-INF/tags/team" prefix="team"%>

<c:set var="link" value='"task_edit?id=${task.id}"'  />
<c:set var="click" value="onclick='document.location.href=${link}' style='cursor:hand;'"  />




<tr onmouseover="this.backup=this.style.backgroundColor;this.style.backgroundColor='red';"
	onmouseout="this.style.backgroundColor=this.backup;"  id="${dif}" >
	<td ${click}><c:out value="${task.id}" /></td>
	<td><object:link id="${task.idObject}"/></td>
	<td><team:link id="${task.idTeam}"/></td>
	<td ${click}><c:out value="${task.jobDescription}"  escapeXml="false"/></td>
	<td ${click}><c:out value="${task.performTime}" /></td>
	<td ${click}>
		<table:select items="новое,принято,отказано,выполнено,завершено" name="status" attr="style='width:160px;'"
			selected="${task.status}" blocked='${true}' />
	</td>
	<td ${click}><c:out value="${task.request}"  escapeXml="false"/></td>

	<td id='l'>
		<connect:display rules="admin">
			<button type="button" onclick="document.location.href='task_edit?id=${task.id}'">edit</button>
			<button type="button" onclick="if (confirm('Уверены?')) document.location.href='task_edit?delete=${task.id}'" style="color:red;">delete</button>
		</connect:display>
		<connect:display rules="objecter">
			<button type="button" onclick="document.location.href='task_edit?id=${task.id}'">view</button>
			<c:if test="${task.status eq 0 or task.status eq 4}">
			<button type="button" onclick="if (confirm('Уверены?')) document.location.href='task_edit?delete=${task.id}'" style="color:red;">delete</button>
			</c:if>
		</connect:display>
		<connect:display rules="tasker,brigadir">
				<button type="button" onclick="document.location.href='task_edit?id=${task.id}'">view</button>
		</connect:display>
	</td>
</tr>